# coding=utf-8
from django.db import models

class JobType(models.Model):
    type_name_en = models.CharField(verbose_name='Type Name', max_length=63)
    type_name_zh = models.CharField(verbose_name='工作类别', max_length=31)
    type_requirement_en = models.TextField(verbose_name='Requirement', blank=True)
    type_requirement_zh = models.TextField(verbose_name='应聘要求', blank=True)
    type_contact_en = models.TextField(verbose_name='Contact', blank=True)
    type_contact_zh = models.TextField(verbose_name='联系方式', blank=True)
    type_rank = models.IntegerField(verbose_name='Rank', default=0, help_text='High value means displaying former')
    type_tag = models.CharField(verbose_name='Abbreviation', unique=True, help_text='Enter an English short name of the group without space', max_length=63)

    def __unicode__(self):
        return self.type_name_zh

    class Meta:
        ordering = ['-type_rank', 'type_name_en', 'type_name_zh']
        verbose_name = 'Job type'

class Job(models.Model):
    job_title_en = models.CharField(verbose_name='Job Title', max_length=63)
    job_title_zh = models.CharField(verbose_name='工作岗位', max_length=31)
    job_location_en = models.CharField(verbose_name='Workplace', default='hangzhou', max_length=63)
    job_location_zh = models.CharField(verbose_name='工作地点', default='杭州', max_length=31)
    job_summary_en = models.TextField(verbose_name='Summary', blank=True)
    job_summary_zh = models.TextField(verbose_name='主要职责', blank=True)
    job_qualifications_en = models.TextField(verbose_name='Qualifications', blank=True)
    job_qualifications_zh = models.TextField(verbose_name='岗位要求', blank=True)
    job_position = models.IntegerField(verbose_name='Positions', default=1)
    job_rank = models.IntegerField(verbose_name='Rank', default=0, help_text='High value means displaying former')
    job_tag = models.CharField(verbose_name='Abbreviation', unique=True, help_text='Enter an English short name of the group without space', max_length=63)
    job_type = models.ForeignKey(JobType)

    def __unicode__(self):
        return self.job_title_zh

    class Meta:
        ordering = ['-job_rank', 'job_title_en', 'job_title_zh']
